﻿#define _CRT_SECURE_NO_WARNINGS 1

//#pragma comment(linker,"entry:fn")

//#pragma   comment(linker,\"/ENTRY:mainCRTStartup\")
//#pragma   comment(linker,\"/subsystem:windows\")

//#pragma   comment(   linker,   \"/subsystem:/\"windows/\"   /entry:/\"mainCRTStartup/\"\")  

#include"gameloop.h"
#include"mainscene.h"
#include"menuScene.h"
#include<stdio.h>

int main()
{	
	//关闭控制台：
	FreeConsole();
	initgraph(422, 750);
	setbkcolor(WHITE);
	cleardevice();

	while (1)
	{

		menuScene menuscene;
		menuSceneInit(&menuscene);
		gameloop((scene*)&menuscene, 60);
		menuSceneDestory(&menuscene);

		mainScene ms;
		mainSceneInit(&ms);
		gameloop((struct scene*)&ms, 60);
		mainSceneDestroy(&ms);

		//游戏结束
		settextcolor(WHITE);
		settextstyle(100, 0, "微软雅黑");

		const char* PStr = "游戏结束";
		RECT r = { 0,200,422,300 };
		drawtext(PStr, &r, DT_CENTER);

		char buff[10];
		sprintf(buff, "得分：%d", ms.mark);
		r = { 0,300,422,400 };
		drawtext(buff, &r, DT_CENTER);

		Sleep(3000);
	}

	closegraph();
	return 0;
}